home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 138
/
Volume 138 Aug 19 2011 - Damaged.iso
/
Games
/
shadez.swf
/
scripts
/
Local
/
Draw
/
CBitmapStripManager.as
< prev
next >
Wrap
Text File
|
2011-08-19
|
4KB
|
131 lines
package Local.Draw
{
import Local.Game.Level.CLevelData;
import STC9.System.CProfiler;
import flash.geom.Point;
public class CBitmapStripManager extends CBitmapStripPlane
{
public static var mFilters:Array;
var _Position:Point;
public function CBitmapStripManager()
{
super(2,2);
mStrips = new Object();
_Position = new Point();
mFilters = new Terrain_Filter().mcFilter.filters;
AddStrips(new CBitmapStrips("ground",new CLevelData.mcTerrainGround(),1,false,false,false));
AddStrips(new CBitmapStrips("decor",new CLevelData.mcTerrainGroundDecor(),1,false,false,true));
AddStrips(new CBitmapStrips("near",new CLevelData.mcTerrainNear(),0.5,false,true,true));
AddStrips(new CBitmapStrips("far",new CLevelData.mcTerrainFar(),0.25,false,true,true));
AddStrips(new CBitmapStrips("sky",new CLevelData.mcTerrainSky(),0.1,true,true,false));
CProfiler.AddDebug("mem strips",String(Math.ceil(mMemSize / 1000)) + "kb");
}
public function set mPosition(param1:Point) : void
{
_Position.x = param1.x;
_Position.y = param1.y;
ValidatePosition();
}
public function Scroll(param1:Number = 0, param2:Number = 0) : void
{
if(true)
{
mPosition = new Point(_Position.x + param1,_Position.y + param2);
}
}
public function get mMemSize() : uint
{
var _loc1_:* = uint(0);
var _loc2_:CBitmapStrips = null;
_loc1_ = uint(0);
for each(_loc2_ in mStrips)
{
§§push(_loc1_);
if(true)
{
§§push(uint(§§pop() + _loc2_.mMemSize));
}
_loc1_ = §§pop();
}
return _loc1_;
}
public function Process() : void
{
mStrips["sky"].mOffsetX += 11;
}
public function get mFineAltitudes() : Array
{
return mStrips["ground"].mFineAltitudes;
}
private function ValidatePosition() : void
{
var _loc1_:CBitmapStrips = null;
if(_Position.x < 0)
{
_Position.x = 0;
}
else if(_Position.x > mStrips["ground"].mSize.x - mBMD.width)
{
_Position.x = mStrips["ground"].mSize.x - mBMD.width;
}
for each(_loc1_ in mStrips)
{
_loc1_.UpdatePosition(_Position);
}
}
public function get mAltitudes() : Array
{
return mStrips["ground"].mAltitudes;
}
public function StartRender() : void
{
CProfiler.StartProfile("Strip.StartRender");
Clear();
StackStrips(mStrips["ground"]);
StackStrips(mStrips["decor"]);
StackStrips(mStrips["near"]);
StackStrips(mStrips["far"]);
StackStrips(mStrips["sky"]);
CProfiler.StopProfile("Strip.StartRender");
}
public function get mPosition() : Point
{
return _Position;
}
public function EndRender() : void
{
CProfiler.StartProfile("Strip.EndRender");
RenderStacks(["ground"]);
CProfiler.StopProfile("Strip.EndRender");
}
public function AddStrips(param1:CBitmapStrips) : void
{
mStrips[param1.mName] = param1;
mDrawStacks[param1.mName] = new Array();
}
public function Render() : void
{
CProfiler.StartProfile("Strip.Render");
RenderStacks(["sky","far","near","decor"]);
CProfiler.StopProfile("Strip.Render");
}
}
}